#ifndef NET_SOCKET_OPT_H_
#define NET_SOCKET_OPT_H_

#include "base/base.h"

namespace net {
class Buffer;
class Socket;
struct Addr;
}

namespace sock {
int32 CreateSocket();
void Close(int sockfd);

bool Bind(net::Socket* s, const net::Addr& addr);
bool Listen(net::Socket* s);
int32 Accept(net::Socket* s, net::Addr* addr);

bool Connect(net::Socket* s, const net::Addr& addr);

bool SetSockOpt(net::Socket* s, int32 level, int32 opt, void* val, size_t len);
bool TrunOnOpt(net::Socket* s, int32 level, int32 opt);
bool TrunOffOpt(net::Socket* s, int32 level, int32 opt);

net::Addr GetSockAddr(net::Socket* s, bool is_local = true);

ssize_t Recv(const net::Socket* sock, net::Buffer* buf);

ssize_t Send(const net::Socket* sock, net::Buffer* buf);
ssize_t Send(const net::Socket* sock, const u_char* buf, size_t buflen);

}

#endif
